import request from '/@/utils/request';
import { paramsSerializer } from '/@/utils/sort';

// 角色列表
export const roleList = (params?: object) => {
  return request({
    url: 'api/v1/admins/role',
    method: 'get',
    params,
    paramsSerializer
  })
}

// 角色详情
export const roleDetail = (id: number) => {
  return request({
    url: `api/v1/admins/role/${id}`,
    method: 'get',
  })
}

// 新增角色
export const addRole = (data: Object) => {
  return request({
    url: `api/v1/admins/role`,
    method: 'post',
    data
  })
}

// 修改角色
export const updateRole = (data: Object) => {
  return request({
    url: `api/v1/admins/role`,
    method: 'put',
    data
  })
}

// 删除角色
export const deleteRole = (id: number) => {
  return request({
    url: `api/v1/admins/role/${id}`,
    method: 'delete'
  })
}
